package com.jiayang.business.equipmenterrorpage;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jiayang.business.equipmenterrorpage.domain.dto.EquipmentErrorQueryDTO;
import com.jiayang.business.equipmentinfopage.domain.dto.DeviceOperationHistoryDTO;
import com.jiayang.business.equipmentinfopage.domain.dto.EquipmentErrorDTO;
import com.jiayang.common.domain.PageResultDTO;
import com.jiayang.common.domain.ResponseDTO;
import com.jiayang.util.JYangPageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ Author     ：OuyangChenglong
 * @ Date       ：Created in 10:11 2021/9/8
 * @ Description：设备报警详情
 * @ Modified By：
 * @Version: $
 */
@Service
public class EquipmentErrorService {

    @Autowired
    private EquipmentErrorDao equipmentErrorDao;

    public ResponseDTO getEquipmentErrorList(EquipmentErrorQueryDTO equipmentErrorQueryDTO) {
        Page page = JYangPageUtil.convert2QueryPage(equipmentErrorQueryDTO);
        List<EquipmentErrorDTO> list = equipmentErrorDao.getEquipmentErrorList(page,equipmentErrorQueryDTO);
        page.setRecords(list);
        PageResultDTO pageResultDTO = JYangPageUtil.convert2PageResult(page);
        return ResponseDTO.succData(pageResultDTO);
    }

    public ResponseDTO getDeviceOperationHistory(String id) {
        List<DeviceOperationHistoryDTO> list = equipmentErrorDao.getDeviceOperationHistory(id);
        return ResponseDTO.succData(list);
    }
}
